<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="Default.css" rel="stylesheet" type="text/css">
       <title>Thêm sản phẩm</title>
    </head>
<style type="text/css">
#a {
	color: blue;
	background-color: #FF9A00;
	display: block;
	text-decoration: none;
	font-family: cursive;
}

#a:HOVER {
	color: #FFFFFF;
	background-color: #FF4700;
	text-decoration: none;
	display: block;
	font-family: cursive;
}

#a:ACTIVE {
	background-color: #FF4700;
	text-decoration: none;
	display: block;
	font-family: cursive;
}
#a:LANG {
	color: #FFFFFF;
	background-color: #FF4700;
	text-decoration: none;
	display: block;
	font-family: cursive;
}
</style>
</head>
<body>
<%
	//String userid=getVal((String)session.getValue("userid"),"");
	//if(userid.equals("")|| userid.equals("0") || userid.equals("-1")|| userid.equals("-2")) response.sendRedirect("admin.jsp");
%>
<p align=center><font style="bold" size=20 >Quản lí khách hàng</font><br></p>
<table width=1024 height=100 align="center">
	<tr>
		<td width=50% align=center><a id="a" href="index.jsp">Trang chủ</a></td>
		<td width=50% align=center><a id="a" href="logout.jsp">Thoát</a></td>
	</tr>
</table>
<table width=1024 align="center" border="1">
<tr>
	<td ><font color=red>Stt</font></td>
	<td ><font color=red>Email</font></td>
	<td ><font color=red>Tên khách hàng</font></td>
	<td ><font color=red>Giới tính</font></td>
	<td ><font color=red>Địa chỉ</font></td>
	<td ><font color=red>Điện thoại</font></td>
	<td ><font color=red>Di động</font></td>
	<td ><font color=red>Sản phẩm mua</font></td>
	<td ><font color=red>Đơn giá</font></td>
	<td ><font color=red>Trạng thái</font></td>
	<td ><font color=red>Thời gian</font></td>
	<td ><font color=red>Thay đổi trạng thái</font></td>
</tr>

<%
	Class.forName("com.mysql.jdbc.Driver");
	Connection con = null;
	Statement smt = null;
	ResultSet rst = null;
	String str = null;
	String ID = null;
	try {
		String username = "root";
		String password = "root";
		String url = "jdbc:mysql://127.0.0.1:3306/laptop";
		con = DriverManager.getConnection(url, username, password);
		System.out.println("Da ket noi CSDL");
		smt = con.createStatement();
		rst = smt.executeQuery("select * from khachhang");
		while(rst.next()) {
			ID = rst.getString("ID");
			out.println("<tr><td >");
			out.println(ID+"</td>");
			out.println("<td valign=top>"+rst.getString(2)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(3)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(4)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(5)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(6)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(7)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(8)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(9)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(10)+"</td>");
			out.println("<td valign=top>");
			out.println(rst.getString(11)+"</td>");
			out.println("<td valign=top align=center>");
			out.println("<form action=changestate.jsp method=GET>");
			out.println("<select name=state>");
			out.println("<option value='0'>đang chờ</option>");
			out.println("<option value='1'>đã giao</option>");
			out.println("</select>");
			out.println("<input type=hidden name=id value='"+ID+"'>");
			out.println("<input type=submit value='Thay đổi'></form></td>");
			out.println( "</tr>");
		}
		con.close();
		System.out.println("Da dong CSDL");
	} catch (Exception e) {}
%>
</table>
</body>
</html>